import 'package:dk_flutter_base/dk_ui.dart';
import 'package:flutter/gestures.dart';

class DkScaffold extends Scaffold {
  DkScaffold(DkScaffoldOption option)
      : super(
          key: option?.key,
          appBar: option?.dkAppBar,
          body: option?.body,
          floatingActionButton: option?.floatingActionButton,
          floatingActionButtonLocation: option?.floatingActionButtonLocation,
          floatingActionButtonAnimator: option?.floatingActionButtonAnimator,
          persistentFooterButtons: option?.persistentFooterButtons,
          drawer: option?.drawer,
          endDrawer: option?.endDrawer,
          bottomNavigationBar: option?.bottomNavigationBar,
          bottomSheet: option?.bottomSheet,
          backgroundColor: option?.backgroundColor,
          resizeToAvoidBottomPadding: option?.resizeToAvoidBottomPadding,
          resizeToAvoidBottomInset: option?.resizeToAvoidBottomInset,
          primary: option?.primary,
          drawerDragStartBehavior: option?.drawerDragStartBehavior,
          extendBody: option?.extendBody,
        );
}

class DkScaffoldOption {
  Key key;
  bool extendBody;
  DkAppBar dkAppBar;
  Widget body;
  Widget floatingActionButton;
  FloatingActionButtonLocation floatingActionButtonLocation;
  FloatingActionButtonAnimator floatingActionButtonAnimator;
  List<Widget> persistentFooterButtons;
  Widget drawer;
  Widget endDrawer;
  Color backgroundColor;
  Widget bottomNavigationBar;
  Widget bottomSheet;
  @Deprecated(
      'Use resizeToAvoidBottomInset to specify if the body should resize when the keyboard appears')
  bool resizeToAvoidBottomPadding;
  bool resizeToAvoidBottomInset;
  bool primary;
  DragStartBehavior drawerDragStartBehavior;

  DkScaffoldOption({
    Key key,
    this.dkAppBar,
    this.body,
    this.floatingActionButton,
    this.floatingActionButtonLocation,
    this.floatingActionButtonAnimator,
    this.persistentFooterButtons,
    this.drawer,
    this.endDrawer,
    this.bottomNavigationBar,
    this.bottomSheet,
    this.backgroundColor,
    this.resizeToAvoidBottomPadding,
    this.resizeToAvoidBottomInset,
    this.primary,
    this.drawerDragStartBehavior,
    this.extendBody,
  }) {
    checkParam();
  }

  void checkParam() {
    primary ??= true;
    extendBody ??= false;
    drawerDragStartBehavior ??= DragStartBehavior.start;
  }
}
